import HttpService from '../../app/services/httpService.js';

class TeamService extends HttpService {
    constructor($http, $q){
        super($http, $q)

        this.URL = this.baseUrl();

        this.OBJ = {
        	TeamListUrl: this.URL + '/team/lists?race_id=',
            TeamCreateUrl: this.URL + '/team/create?race_id=',
            TeamDetailUrl: this.URL + '/team/detail?team_id=',
            TeamUpdateUrl: this.URL + '/team/update?team_id=',
            TeamDelUrl: this.URL + '/team/del?race_id=',
            TeamRunnerUrl: this.URL + '/team/runner?team_id=',
        }

    }

    /* 获取分组列表 */
    getTeamList(headers, search) {
        return this.getRequest(this.OBJ.TeamListUrl, headers, search);
    }
    
    /* 创建分组 */
    postTeamCreate(params, headers, search) {
        return this.postRequest(this.OBJ.TeamCreateUrl, params, headers, search);
    }
    
    /* 获取分组详情 */
    getTeamDetail(headers, search) {
        return this.getRequest(this.OBJ.TeamDetailUrl, headers, search);
    }
    
    /* 更新分组 */
    postTeamUpdate(params, headers, search) {
        return this.postRequest(this.OBJ.TeamUpdateUrl, params, headers, search);
    }
    
    /* 删除分组 */
    postTeamDel(params, headers, search) {
        return this.postRequest(this.OBJ.TeamDelUrl, params, headers, search);
    }

    /* 获取团队成员列表 */
    getTeamRunner(headers, search) {
        return this.getRequest(this.OBJ.TeamRunnerUrl, headers, search);
    }

}

export default TeamService;